<template>
    <table>
        <tr>

            <th>手机号</th>
            <th>
                <input type="text" v-model="Phone" placeholder="请输入手机号">
            </th>

        </tr>
           

        <tr>

                <th>密码</th>
                    <th>
                    <input type="password" v-model="pwd" placeholder="请输入密码">
                    </th>

                    </tr>


                    <tr>

<th></th>
    <th>
        <button @click="Login" value="登陆">登陆</button>
    </th>

    </tr>



    </table>
 




</template>





<script setup lang="ts">

  import router from '@/router';
import axios from 'axios';
import {ref} from 'vue';
  import { useRouter ,createRouter } from 'vue-router';




  const Phone=ref('')
  const pwd=ref('')


const Login=()=>{

        axios.get('https://localhost:7188/api/Member/Login',{params:{

            Phone:Phone.value,
            Pwd:pwd.value,

        }}).then(res=>{

            if(res.data.id>0)
        {
                router.push('/DengjiADd')

                alert('登陆成功')


        }
        else      if(res.data.id==-1)
        {
                alert('用户名不存在')

        }
        else      if(res.data.id==-2)
        {
                alert('账号密码不匹配')

        }
        })

}


</script>